Conversation
a712962 to
5576861
Compare
|
Claude finished @bdesoky's task —— View job Code Review for PR #8955: feat: thread encryptionVersion in SDKTodo List
SummaryThis PR successfully implements encryption version threading throughout the BitGoJS SDK, adding support for v2 encryption envelopes while maintaining backward compatibility. The implementation is thorough and well-tested. Strengths✅ Comprehensive Implementation
✅ Excellent Test Coverage
✅ Security Best Practices
✅ Code Quality
Areas for Improvement🔍 Minor Concerns
Technical AssessmentArchitecture: The threading approach is well-designed, using optional parameters consistently and providing both sync and async variants where needed. Backward Compatibility: Excellent - all changes are additive and maintain existing behavior when Performance: No performance concerns - async functions are used appropriately for v2 encryption. Security: The implementation correctly uses the newer Argon2id-based v2 encryption when requested while maintaining v1 SJCL compatibility. Files with Excellent Implementation
Recommendation✅ APPROVE - This is a well-implemented feature with excellent test coverage and proper security considerations. The changes successfully enable v2 encryption support while maintaining full backward compatibility. The code is production-ready and follows BitGo's development standards. The comprehensive test suite provides confidence in the implementation's correctness. |
| encryptedRShare = await this.bitgo.encryptAsync({ | ||
| input: stringifiedRShare, | ||
| password: params.walletPassphrase, | ||
| encryptionVersion: 1, |
There was a problem hiding this comment.
hardcoding the version to 1 here since v2 would have gone through the useV2 branch above
| input: userGpgKey.privateKey, | ||
| password: walletPassphrase, | ||
| adata: `${EddsaMPCv2Utils.MPS_DSG_SIGNING_USER_GPG_KEY}:${adata}`, | ||
| encryptionVersion: 1, |
| const encryptedPrv = await bitgo.encryptAsync({ password: prfPassword, input: privateKey, encryptionVersion: 2 }); | ||
| const encryptedPrv = await bitgo.encryptAsync({ password: prfPassword, input: privateKey, encryptionVersion }); |
There was a problem hiding this comment.
there are no callers of this methods after a github search
There was a problem hiding this comment.
hmm you wanna check with @mohammadalfaiyazbitgo on this one?
| const encryptedPrv = await bitgo.encryptAsync({ password: prfPassword, input: privateKey, encryptionVersion: 2 }); | ||
| const encryptedPrv = await bitgo.encryptAsync({ password: prfPassword, input: privateKey, encryptionVersion }); |
There was a problem hiding this comment.
hmm you wanna check with @mohammadalfaiyazbitgo on this one?
| const doc = await drawKeycardAsync({ | ||
| jsPDF, | ||
| QRCode, | ||
| encrypt: (p: { input: string; password: string }) => this.bitgo.encryptAsync(p), | ||
| encrypt: (p: { input: string; password: string }) => this.bitgo.encryptAsync({ ...p, encryptionVersion }), |
There was a problem hiding this comment.
encryptionVersion is missing from drawKeycardAsync's encrypt callback type
There was a problem hiding this comment.
encryptionVersion isnt passed from the parameters in this case but Ive changed it to add it to drawKeycardAsync's type and thread it from its callers
|
AFAIK no, this module is still in beta. |
Ticket: WCN-774
This pull request introduces support for selecting an encryption version (either v1 or v2) across various wallet operations, including key encryption, wallet sharing, QR data generation, and secret splitting. The changes add an optional
encryptionVersionparameter to relevant APIs, types, and internal calls, ensuring that encryption can be consistently upgraded or specified throughout the codebase. Comprehensive tests are added to verify correct behavior for both v1 and v2 encryption envelopes.Encryption Version Support Across Modules
encryptionVersionparameter to key encryption functions and types insdk-api,key-card,passkey-crypto, andexpressmodules, allowing callers to specify which encryption version to use. [1] [2] [3] [4] [5]encryptAsyncand related encryption operations to pass through theencryptionVersionparameter where provided. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]API and Type Updates
UpdateLightningWalletClientRequest,GenerateQrDataCoinParams,SplitSecretOptions) to include theencryptionVersionfield. [1] [2] [3]encryptionVersionthrough wallet update, sharing, and keychain creation flows. [1] [2] [3] [4]QR Data Generation Enhancements
encryptionVersion, ensuring that the passphrase envelope (Box D) is created with the correct version. [1] [2] [3]Testing and Validation
encryptionVersionparameter, and that Box D is omitted when required fields are missing. [1] [2]Dependency and Import Updates
EncryptionVersiontype where needed. [1] [2] [3] [4]These changes collectively ensure that encryption versioning is handled robustly and consistently throughout the codebase, improving security flexibility and future-proofing wallet operations.